<template>
  <view class="container">
    <z-nav-bar backState='3000' @backClick='backClick' type='transparent' :titleCenter='true' title=''></z-nav-bar>
    <public-module></public-module>
    <div class="bumen-bg">
      <div class="bumen-grid">
        <div v-for="item in bumenList" :key="item.id" class="bumen-item" @click="goYewu(item)">
          {{ item.bmmc }}
        </div>
      </div>
    </div>
  </view>
</template>

<script>
import $http from '@/config/requestConfig'
export default {
	data() {
		return {
			bumenList: [],
			pid: '',
			blqy: ''
		};
	},
	//第一次加载
	onLoad(options) {
		uni.hideTabBar();
		// 获取参数
		this.pid = options.pid || '';
		this.blqy = options.blqy || '';
		this.getBumenList();
	},
	//页面显示
	onShow() {
		uni.hideTabBar();
	},
	//方法
	methods: {
		backClick() {
			uni.navigateBack()
		},
		getBumenList() {
			$http.get('Person/scdee', { pid: this.pid, blqy: this.blqy }).then(res => {
				if (res && res.data) {
					this.bumenList = res.data;
					
				} else {
					this.bumenList = [];
				}
			}, err => {
				uni.showToast({ title: '获取部门失败', icon: 'none' });
			});
		},
		goYewu(item) {
			uni.navigateTo({
				url: `/pages/print/yewu?depid=${item.depid}&id=${item.id}`
			});
		}
	},
	//页面隐藏
	onHide() {},
	//页面卸载
	onUnload() {},
	//页面下来刷新
	onPullDownRefresh() {},
	//页面上拉触底
	onReachBottom() {},
	//用户点击分享
	onShareAppMessage(e) {
		
	}
};
</script>

<style scoped>
.bumen-bg {
  min-height: 100vh;
  background: linear-gradient(135deg, #165DFF 0%, #4080FF 50%, #6AA1FF 100%);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 220rpx 0;
}
.bumen-grid {
  width: 96%;
  display: flex;
  flex-wrap: wrap;
  gap: 24rpx 24rpx;
  justify-content: center;
}
.bumen-item {
  flex: 1 1 180rpx;
  min-width: 20%;
  max-width: 60%;
  background: #fff;
  border-radius: 12rpx;
  text-align: center;
  font-size: 3.5vh;
  font-weight: 500;
  padding: 18rpx 0;
  margin-bottom: 0;
  box-shadow: 0 2px 8px 0 rgba(22,93,255,0.08);
  transition: all 0.2s ease;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.bumen-item:active {
  transform: scale(0.98);
  background: #f8faff;
  box-shadow: 0 1px 4px 0 rgba(22,93,255,0.12);
}
</style>
